{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="标题" name="news_title" value="{$vo.news_title ?? ''}"  datatype="*" nullmsg="请输入标题" errormsg="请输入标题">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>简介：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="简介" name="news_con" value="{$vo.news_con ?? ''}"  datatype="*" nullmsg="请输入简介" errormsg="请输入简介">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">详情：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <!--<input type="text" class="input-text" placeholder="详情" name="news_detail" value="{$vo.news_detail ?? ''}" >-->
                <div id="editor" name="news_detail" class="mt-20"></div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--用来存富文本框的初值，notempty是针对添加页面的-->
        <div class="ueText hidden">
            {notempty name='vo.news_detail'}
            {$vo.news_detail|htmlspecialchars_decode}
            {/notempty}
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>
    $(function () {
        var ue = UE.getEditor('editor');
//        拿到便签内的文本
        var ueText=$(".ueText").html();
//        给富文本框赋初值
        ue.addListener("ready", function (){
            // editor准备好之后才可以使用
            UE.getEditor('editor').setContent(ueText);
        });

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
    })
</script>
{/block}
